package com.oak.designmode._07_proxyParttern.dynamicProxy;


import com.oak.designmode._07_proxyParttern.CGLibProxy.CglibProxy;
import net.sf.cglib.proxy.Proxy;

import javax.xml.crypto.Data;
import java.util.Date;

/**
 * 动态代理
 *
 * @Description  JDK动态代理，代理实现接口的类
 * @Author guoxy
 * @Date 2019/11/30
 * @Version 1.0
 */
public class Test {

    public static void main(String[] args) {

        long startTime = (new Date()).getTime();
        for(int i = 0; i < 100000; i++){
            demo();
        }
        long endTime= (new Date()).getTime();

        System.out.println(endTime - startTime);
    }

    public static void demo() {
        BuyHouse buyHouse = new BuyHouseImpl();
        BuyHouse proxyBuyHouse = DynamicProxyHandler.newProxyInstance(buyHouse);
        proxyBuyHouse.buyHouse();
    }

}
